package text_2023_09_21;

import java.util.Scanner;

/**
 * @author Vv
 * @version 1.0
 * @project coding_learn
 * @description
 * @date 2023/9/21 11:07:51
 */

class mailtest{
    public String email;
    public boolean isilg(){
        if(!email.contains("@") || !email.contains(".")){
            return false;
        }
        char[] str = email.toCharArray();
        boolean isover1 = false;
        boolean isover2 = false;
        for(int i = 0;i<str.length;i++){
            if(isover1 && str[i] == '@'){
                return false;
            }
            if(isover2 && str[i] == '.'){
                return false;
            }
            if( str[i] != '.' && str[i] != '@' && !(str[i] >= '0' && str[i] <= '9' ) && !(str[i] >= 'a' && str[i] <= 'z') && !(str[i] >= 'A' && str[i] <= 'Z')){
                return false;
            }
            if(str[i] == '.'){
                isover2 = true;
            }
            if(str[i] == '@'){
                isover1  = true;
            }
        }
        return true;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
}
public class JujjyEmail {
    public static void main(String[] args) {
        mailtest a = new mailtest();
        a.setEmail("2889369493@qq.com");
        System.out.println(a.isilg());
    }


}
